﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Commerce/Views/Shared/Backend.Master"
    Inherits="System.Web.Mvc.ViewPage<ISupportTicket>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:"Edit Support ticket".Localize()%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="title">
        <%:"Edit Support ticket".Localize()%><a href='<%= ViewData["index_action"] %>'><%:"Back to list".Localize() %></a></h3>
    <div class="support-block">
        <div class="support-info">
            <h4 class="title">
                <%: this.Model.Subject %></h4>
            <a href="#">
                <%: this.Model.Customer.FullName() %></a> <span class="date">
                    <%: this.Model.CreateDate %></span><div>
                        <form action='<%= ViewData["changestatus_action"] %>' method="post" class="changestatus-form">
                        <%: Html.DropDownList("status", ViewData["Status"] as SelectableList, new {disabled = "disabled" })%>
                        <a class="o-icon edit display-view" href="#" title="Edit">
                            <%:"Edit".Localize() %></a> <a class="o-icon save edit-view hide"
                            href="#" title="Save">
                            <%:"Save".Localize() %></a> <a class="o-icon cancel edit-view hide" href="#" title="Cancel">
                                <%:"Cancel".Localize() %></a>
                        </form>
                    </div>
        </div>
        <p>
            <%: this.Model.Body %></p>
    </div>
    <% foreach (var item in this.Model.SupportReplies)
       {
           if (item.IsAdminReply)
           {
    %>
    <div class="support-block admin-block">
        <div class="support-info">
            <h5 class="title">
                <%: item.Subject %></h5>
            <span class="author">
                <%: item.UserName %></span> <span class="date">
                    <%: item.CreateDate %></span>
        </div>
        <p>
            <%: item.Body %></p>
    </div>
    <%
           }
           else
           {
    %>
    <div class="support-block">
        <div class="support-info">
            <h5 class="title">
                <%: item.Subject %></h5>
            <span class="author">
                <%: item.UserName %></span> <span class="date">
                    <%: item.CreateDate %></span>
        </div>
        <p>
            <%: item.Body %></p>
    </div>
    <%}
       }%>
    <div class="common-form support-form">
        <form action="<%= ViewData["reply_add_action"] %>" method="post" id="reply_form">
        <fieldset>
            <legend>
                <%:"Reply".Localize() %></legend>
            <table>
                <tr>
                    <th>
                        <label>
                            <%:"Subject".Localize() %></label>
                    </th>
                    <td>
                        <input type="text" class="medium" name="Subject" value="Re:<%= this.Model.Subject %>" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <label>
                            <%:"EMail".Localize() %></label>
                    </th>
                    <td>
                        <input type="text" class="medium" name="Email" />
                    </td>
                </tr>
                <tr>
                    <th>
                        <label>
                            <%:"Content".Localize() %></label>
                    </th>
                    <td>
                        <textarea name="Body"></textarea>
                    </td>
                </tr>
            </table>
        </fieldset>
        <div class="buttons">
            <button type="submit">
                <%:"Reply".Localize() %></button>
        </div>
        </form>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MenuContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="WidgetContent" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ScriptContent" runat="server">
    <%using (var loader = ClientLoader.RegisterInstance())
      {
          loader.Require("supportticket.edit.js");
      } %>
</asp:Content>
